# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@alpinelinux.org>
pkgname=spacefm
pkgver=1.0.6
pkgrel=1
pkgdesc="Multi-panel tabbed file manager (GTK2 version)"
arch=all
url="http://ignorantguru.github.com/spacefm"
license="GPL-3.0-or-later"
depends="bash"
makedepends="intltool gettext-dev gtk+2.0-dev gtk+3.0-dev eudev-dev ffmpegthumbnailer-dev linux-headers"
subpackages="$pkgname-lang $pkgname-doc $pkgname-gtk3 $pkgname-gtk3-lang:lang3:noarch $pkgname-gtk3-doc:doc3:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/IgnorantGuru/spacefm/archive/$pkgver.tar.gz
	spacefm-include-sysmacros.patch"

builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	default_prepare
	update_config_guess
}

build() {
	cd "$builddir"
	./configure --prefix=/usr \
		--with-gtk2\
		-disable-pixmaps
	make
}

gtk3() {
	pkgdesc="Multi-panel tabbed file manager (GTK3 version)"
	replaces="spacefm"

	cd "$builddir"
	make clean

	./configure --prefix=/usr \
		--with-gtk3\
		-disable-pixmaps

	make
	make -j1 DESTDIR="$subpkgdir" install
}

lang3() {
	mkdir -p "$subpkgdir/usr/share"
	mv "${pkgdir%*spacefm}$pkgname-gtk3/usr/share/locale" "$subpkgdir/usr/share/"
}

doc3() {
	mkdir -p "$subpkgdir/usr/share"
	mv "${pkgdir%*spacefm}$pkgname-gtk3/usr/share/doc" \
		"$subpkgdir/usr/share/"
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
}

sha512sums="37fc0dd31f02158502f592415b4c375ee49560af6f03d75b035d7c6c45bdc47064bba1ae8987b4cc8be2e02b3dfcdc17ec760411975e7b5f74343a2293fb2c8c  spacefm-1.0.6.tar.gz
d7b33441700141dc956df54f03393c02783fc5188b82883401d4781c52fb383089af5ed3b3645b686078a6ac06d3b3e269f7ee5ab3f4d1416ebb0141fbaa7b7e  spacefm-include-sysmacros.patch"
